
#ifndef PNJ_H
#define PNJ_H

#include <iostream>
#include <string>
#include <SFML/Graphics.hpp>

#include "var_define.h"
#include "MoveAnim.h"
#include <pthread.h>

using namespace std;
using namespace sf;
class Pnj
{
    /* Attributs */
    protected:

        string name;
        string surname;
        Image* imgPnjHead;
        string linkPnjHead;
        string linkPnjMovement;
        bool canMove;
        Image* imgPnjMovement;
        Sprite* pnjHead;
        Sprite* movement;
       MoveAnim moveAnim;
       pthread_t thread;
       volatile bool isMoving;
       int caseX;
       int caseY;

    public:
        static void* threadRunAnim(void* pnj);
        void runAnim();
        Pnj(string n = "", string s = "", string f = "zombie", string m = "zombie");
        ~Pnj();
        string& getName();
        string& getSurname();
        Sprite* getPnjHead();
        Sprite* getPnjMovement();
        int getPositionX();
        int getPositionY();

        inline const float* getP_PositionX() {return &movement->GetPosition().x;}
        inline const float* getP_PositionY() {return &movement->GetPosition().y;}

        void setName(string n);
        void setSurname(string s);
        void setImgPnjHead(string s);
        void setimgPnjMovement(string s);
        void setPosition(int x, int y);
        virtual bool askAnim(int d, bool moveOn);
        bool getIsMoving();
        void setIsMoving(bool b);

        void setCanMove(bool c) {canMove = c;}

        int getCaseX();
        int getCaseY();

        int getDestCaseX();
        int getDestCaseY();

        void rotate(int d);
        int getDirection();

        void setHeadPosition(int i, int j);

        void waitMovement();



};

#endif
